'use strict';
const BaseService = require('./base');


class SysRoleMenuService extends BaseService {


    async checkMenuExistRole(menuId) {
        let sql = `
                    select count(1) as count
                        from sys_role_menu
                        where menu_id =?
                  `;
        let result = await this.executeSqlFirst(sql, [menuId]);
        return result ? result.count || 0 : 0;
    }

    async deleteRoleMenuByRoleId(roleId,conn){
        let sql = ` delete
        from sys_role_menu
        where role_id = ?`;
        let size = await this.executeSqlSucc(sql,[roleId],conn);
        return size;
    }



}

module.exports = SysRoleMenuService;
